home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
eflibpt4.zip
/
DEMO
/
DATATYPE
/
QUEUE2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-08-09
|
1KB
|
41 lines
{ Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
Demonstration; queues #2 - the circular queue
EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED. }
uses EFLIBDEF, EFLIBINI, EFLIBDAT;
var MyQueue : QueueObjectType; Index, Number : integer;
begin
WriteLn ('* Circular queue demonstration *');
{ Initializes queue and stores 25 integer numbers in structure }
with MyQueue do begin
{ Initialize a circular queue with access restriction }
InitializeQueue (SizeOf(Integer), TRUE, FALSE);
{ Element size } { Access restriction }
{ Circular }
{ Place numbers in queue }
for Index := 25 downto 1 do Store (Index);
{ Reverse entire queue - will give the same result as a replacement
of the for-loop interval "25 downto 1" with "1 to 25". }
Reverse;
{ Display queued data and recycle 8 times }
for Index := 1 to 200 do begin
Retrieve (Number);
Write (Number:5);
end;
WriteLn;
Intercept;
end;
end.